<!-- 科研管理-样品管理--委托单位 -->
<template>
  <div class="JNPF-common-layout">
    <div class="JNPF-common-layout-center">
      <el-row class="JNPF-common-search-box" :gutter="16">
        <el-form @submit.native.prevent>

          <el-col :span="6">
            <el-form-item label="客户名称">
              <el-input v-model="listQuery.fcatname" placeholder="请输入编号或名称" clearable />
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="联系人">
              <el-input v-model="listQuery.fcatname" placeholder="请输入姓名" clearable />
            </el-form-item>
          </el-col>

          <template v-if="showAll">
            <el-col :span="6">
            <el-form-item label="手机号码">
              <el-input v-model="listQuery.fcatname" placeholder="请输入手机号" clearable />
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="客户状态">
              <el-select v-model="listQuery.fcustomno" placeholder="请选择"
                :disabled="$store.getters.userInfo.manufacturer">
                <el-option
                  v-for="item in options1"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </template>

          <el-col :span="12">
            <el-form-item label="">
              <el-button type="primary" icon="el-icon-search" @click="getlist">查询</el-button>
              <el-button type="success" icon="el-icon-plus" @click="insert(undefined)">新增</el-button>
              <el-button type="warning" icon="el-icon-upload2">导入</el-button>
              <el-button type="text" icon="el-icon-arrow-down" @click="showAll = true" v-if="!showAll">展开</el-button>
              <el-button type="text" icon="el-icon-arrow-up" @click="showAll = false" v-else>收起</el-button>
            </el-form-item>
          </el-col>
        </el-form>
      </el-row>
      <div class="JNPF-common-layout-main JNPF-flex-main">
        <JNPF-table :data="list" border v-loading="loading">
          <el-table-column prop="FCATNO" label="客户编号" ></el-table-column>
          <el-table-column prop="FCATNAME" label="客户名称"></el-table-column>
          <el-table-column prop="FLINKNAME" label="联系人" width="115"></el-table-column>
          <el-table-column prop="FMOILE" label="手机号码" ></el-table-column>
          <!-- <el-table-column prop="FTELNO" label="电话号码" width="95"></el-table-column> -->
          <!-- <el-table-column prop="FEMAIL" label="邮箱地址" width="120"></el-table-column> -->
          <!-- <el-table-column prop="FADDRESS" label="联系地址"> </el-table-column> -->
          <el-table-column prop="FSTATE" label="状态" width="95"></el-table-column>
          <el-table-column fixed="left" label="操作" width="150">
            <template slot-scope="scope">
              <el-button @click.native.prevent="insert(scope.row.FCATNO)" icon="el-icon-edit" type="text" size="small">
                编辑
              </el-button>
              <el-popconfirm title="确定删除当前数据吗？" @confirm="Catdelete(scope.row.FCATNO)">
                <el-button slot="reference" icon="el-icon-delete" style="color: red;margin-left: 10px;"
                  type="text">删除</el-button>
              </el-popconfirm>
            </template>
          </el-table-column>
        </JNPF-table>
        <pagination :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" />
        <Form ref="Form" :parelist="list" />
      </div>
    </div>
  </div>
</template>

<script>
  import Form from "./Form.vue"
  export default {
    name: 'shop',
    components: { Form },
    data() {
      return {
        showAll:false,
        total: 0,
        list: [
        {
          "FCATNO": "S19101",
          "FCATNAME": "上海全是肉供应链管理有限公司",
          "FLINKNAME": "王某",
          "FMOILE":"13819903874",
          "FTELNO":"",
          "FEMAIL":"283040596@qq.com",
          "FADDRESS": "上海市宝山区",
          "FSTATE": "正常",
          "FOPERATOR": "system",
          "FUPDDATE": "2011-02-16T02:57:02.000+00:00"
        },{
          "FCATNO": "S18193",
          "FCATNAME": "‌烟台市董果巴巴食品有限公司",
          "FLINKNAME": "张某",
          "FMOILE":"17787903874",
          "FTELNO":"",
          "FEMAIL":"283048643@qq.com",
          "FADDRESS": "山东‌烟台",
          "FSTATE": "正常",
          "FOPERATOR": "system",
          "FUPDDATE": "2011-02-16T02:57:02.000+00:00"
        },{
          "FCATNO": "S21209",
          "FCATNAME": "江苏凌家塘市场发展有限公司",
          "FLINKNAME": "杨某",
          "FMOILE":"16619907674",
          "FTELNO":"",
          "FEMAIL":"567840596@qq.com",
          "FADDRESS": "江苏昆山",
          "FSTATE": "正常",
          "FOPERATOR": "system",
          "FUPDDATE": "2011-02-16T02:57:02.000+00:00"
        },{
          "FCATNO": "S21178",
          "FCATNAME": "无锡洛亿商贸有限公司",
          "FLINKNAME": "刘某",
          "FMOILE":"13270130333",
          "FTELNO":"",
          "FEMAIL":"567840596@qq.com",
          "FADDRESS": "江苏省无锡市梁溪区沁园新村无锡洛亿商贸有限公司",
          "FSTATE": "正常",
          "FOPERATOR": "system",
          "FUPDDATE": "2011-02-16T02:57:02.000+00:00"
        }
        ],

        //所属校区选择数据
        options1: [{
          value: '1',
          label: '正常'
        }, {
          value: '2',
          label: '停用'
        }],

        loading: false,
        listQuery: {
          page: 1,
          limit: 20,
          sort: "desc",
          sidx: "",
          fcatno: "",
          fcatname: ""
        },
      };
    },
    computed: {},
    created() {
    },
    methods: {
      insert(row) {
        this.$refs.Form.init(row);
      },
    },
  };
</script>